package cn.javass.dp.strategy.mydemo1;

import java.math.BigDecimal;

import static cn.javass.dp.strategy.mydemo1.CostsType.PACK_COSTS;
import static java.lang.String.*;

/**
 * 统一接受参数
 * 关联结果集
 */
public class Context {

    private CalcStrategy strategy;

    public Context(CostsType type, double weight, double volume, String lat, String lng, String address) {
        switch (type) {
            case PACK_COSTS:
                strategy = new PackCosts(weight, volume);
                break;
            case DISTRIBUTION_COSTS:
                strategy = new DistributionCosts(weight, volume, lat, lng, address);
                break;
            default:
        }
    }

    public BigDecimal calcCosts () {
        return this.strategy.calcCosts();
    }

}
